package coreconcurrency.entity;

/**
 * create by yongli on 2021-11-27 16:53
 * 使用volatile修饰的变量，在多线程下未必是线程全的
 * 线程安全=====》操作具有原子性
 */

public class SafeAccount implements Account {
    //
    private volatile double number;

    public SafeAccount() {
    }

    public SafeAccount(double number) {
        this.number = number;
    }

    @Override
    public double getNumber() {
        return number;
    }

    @Override
    public void setNumber(double number) {
        this.number = number;
    }
}
